package cn.quartz;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;
import org.quartz.Trigger;

public class FirstJob implements Job {

	Double triggerDouble;//与jobDataMap的key一一对应
	
	public Double getTriggerDouble() {
		return triggerDouble;
	}

	public void setTriggerDouble(Double triggerDouble) {
		this.triggerDouble = triggerDouble;
	}

	public void execute(JobExecutionContext context) throws JobExecutionException {
		System.out.println("Job Start Time Is: "+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		System.out.println("Hello World!");
		System.out.println("打印job上下文信息");
		JobKey key = context.getJobDetail().getKey();
		System.out.println("key: "+key.getName()+"+"+key.getGroup());
		JobDataMap dataMap = context.getMergedJobDataMap();
		System.out.println("message: "+dataMap.getString("message"));
		System.out.println("triggerDouble:"+ triggerDouble);
		Trigger currentTrigger = context.getTrigger();
		System.out.println("trigger start Time is: "+currentTrigger.getStartTime());
	}

}
